const path = require('path')
const htmlWebpackPlugin = require('html-webpack-plugin')

module.exports = {
  entry: path.join(__dirname, './src/main.js'),
  output: {
    path: path.join(__dirname, './dist'),
    filename: 'bundle.js'
  },
  plugins: [
    new htmlWebpackPlugin({
      template: path.join(__dirname, './src/index.html'),
      filename: 'index.html'
    })
  ],
  module: {
    rules: [
      { test: /\.css$/, use: ['style-loader','css-loader'] },
      { test: /\.less$/, use: ['style-loader','css-loader','less-loader'] },
      { test: /\.scss$/, use: ['style-loader','css-loader','sass-loader'] },
      { test: /\.(jpg|png|gif|svg|jpeg|bmp)$/, use: 'url-loader?limit=1&name=[hash:8]-[name].[ext]' },
      { test: /\.(eot|ttf|svg|woff|woff2)$/, use: 'url-loader' },
      { test: /\.js$/, use: 'babel-loader', exclude: /node_modules/},
      { test: /\.vue$/, use: 'vue-loader'}
    ]
  },
  resolve: {
    alias: {
      // "vue$": "vue/dist/vue.js"
    }
  },
  resolveLoader:{
    alias: {
      'scss-loader':'sass-loader'
    },
  },
  // dev: {
  //   proxyTable: {//在这里面配置代理跨域
  //     '/api': {  
  //       target: 'https://api.douban.com',  
  //       changeOrigin: true,  
  //       pathRewrite: {  
  //           '^/api': '/'  
  //           //写'/api'就等于写'https://api.douban.com'
  //           //写"/api/v2/movie/top250"就等于写"https://api.douban.com/v2/movie/top250"
  //       }  
  //     }
  //   } 
  // }
 }